
function rewriteHistoryFun<T extends keyof History>(targetName: T): () => unknown {
    let origin = history[targetName];

    return function (this: any) {
        let result = origin.apply(history, arguments);
        let event = new Event(targetName);
        dispatchEvent(event);
        if (result === history) {
            return this;
        }
        return result;
    }
}



export { rewriteHistoryFun }



